<template>
  <div class="p-2 bg-white">
    <div>
      <el-select v-model="treatmentType" placeholder="请选择" class="width220" @change="changeTreatmentType">
        <el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
      </el-select>
    </div>
     <div class="px-2"><allPlan  ref="allPlanRef" :treatmentType="treatmentType"></allPlan></div> 
  </div>
</template>
<script>
import {treatmentTypeList} from "plugins/axios/inquiryRecord.js"

// 治疗疗程计划form
import courseTreatmentForm from 'views/operationManage/components/inquiryRecordDetail/treatmentPlan/courseTreatmentForm.vue';
// 治疗计划列表
import treatmentTable from 'views/operationManage/components/inquiryRecordDetail/treatmentPlan/treatmentTable.vue';

// 所有治疗计划
import allPlan from 'views/operationManage/components/inquiryRecordDetail/allPlan.vue';
import {getCalendar}  from 'plugins/calendar.js'
import {mapState} from 'vuex'
export default {
  components:{
    courseTreatmentForm,
    treatmentTable,
    allPlan
  },
  props:{
    providerId:{
      type:[String,Number]
    }
  },
  data(){
    return{
      calendarObj:{},
      calendarList:[],
      typeList:[],
      treatmentType:''
    }
  },
  created(){
    let self = this;
    treatmentTypeList().then(res=>{
      self.typeList=res.content;
       self.typeList.unshift({id:'0',name:'所有类型'});
      self.treatmentType=res.content[0].id
    })
  },
  mounted(){
    this.init(new Date())
  },
  watch:{},
  computed:{},
  methods:{
    init(date){
      this.calendarObj = getCalendar(date);
      this.$refs.allPlanRef.init(this.treatmentType)
    },
   changeTime(date){
      this.init(date)
   },
   changeTreatmentType(val){
     this.treatmentType=val;
     this.$refs.allPlanRef.init(this.treatmentType);
   }
  }
}
</script>
<style scoped>
</style>